<template>
  <div class="blog-post">
    <div class="post-header">
      <h2 class="post-title">
        <a :href="post.link" class="post-link">{{ post.title }}</a>
      </h2>
      <div class="post-meta">
        <span class="post-date">{{ post.date }}</span>
        <span class="post-author">By {{ post.author }}</span>
        <span v-if="post.category" class="post-category">{{ post.category }}</span>
      </div>
    </div>
    <div class="post-content">
      <p>{{ post.excerpt }}</p>
    </div>
    <div class="post-footer">
      <a :href="post.link" class="read-more">阅读更多 →</a>
      <div class="post-tags">
        <span v-for="tag in post.tags" :key="tag" class="tag">{{ tag }}</span>
      </div>
    </div>
  </div>
</template>

<script setup>
defineProps({
  post: {
    type: Object,
    required: true,
    default: () => ({
      title: '文章标题',
      link: '#',
      date: '2025-01-01',
      author: '作者',
      category: '分类',
      excerpt: '文章摘要...',
      tags: []
    })
  }
})
</script>

<style scoped>
.blog-post {
  background: var(--color-background-soft);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s, box-shadow 0.3s;
}

.blog-post:hover {
  transform: translateY(-5px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.post-header {
  margin-bottom: 1rem;
}

.post-title {
  margin: 0 0 0.5rem 0;
  font-size: 1.5rem;
}

.post-link {
  text-decoration: none;
  color: var(--color-heading);
  transition: color 0.3s;
}

.post-link:hover {
  color: #42b883;
}

.post-meta {
  display: flex;
  gap: 15px;
  font-size: 0.9rem;
  color: var(--color-text);
  opacity: 0.8;
}

.post-content {
  margin-bottom: 1.5rem;
}

.post-content p {
  line-height: 1.6;
  margin: 0;
}

.post-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--color-border);
  padding-top: 1rem;
}

.read-more {
  text-decoration: none;
  color: #42b883;
  font-weight: 500;
  transition: color 0.3s;
}

.read-more:hover {
  color: #349c6f;
}

.post-tags {
  display: flex;
  gap: 8px;
}

.tag {
  background: #e0f0e9;
  color: #42b883;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.8rem;
}

.tag:hover {
  background: #42b883;
  color: white;
}
</style>